package com.spring.mvc.Interceptor;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by Admin on 9/27 0027.
 */
@ControllerAdvice
public class HandlerException {
    @ExceptionHandler({ArithmeticException.class})
    public ModelAndView testException(Exception ex){
        System.out.println("---->error: "+ex);
        ModelAndView mv=new ModelAndView("error");
        mv.addObject("exception",ex);
        return mv;
    }
}
